import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/celery-delivery/delivery/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/celery-delivery/delivery/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/celery-delivery/delivery/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const cancelSF = (ids) => {
  return request({
    url: '/api/celery-delivery/delivery/cancel-sf',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/celery-delivery/delivery/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/celery-delivery/delivery/submit',
    method: 'post',
    data: row
  })
}

export const general = (date) => {
  return request({
    url: '/api/celery-delivery/delivery/general',
    method: 'post',
    params: {
      date,
    }
  })
}

export const sfOrder = (date) => {
  return request({
    url: '/api/celery-delivery/delivery/sf-order',
    method: 'post',
    params: {
      date,
    }
  })
}
export const sfOrderByIds = (ids) => {
  return request({
    url: '/api/celery-delivery/delivery/sf-order-by-ids',
    method: 'post',
    params: {
      ids,
    }
  })
}
export const sfToken = () => {
  return request({
    url: '/api/celery-delivery/delivery/sf-token',
    method: 'post',
    params: {}
  })
}

export const updatePrintStatus = (id) => {
  return request({
    url: '/api/celery-delivery/delivery/update-print-status',
    method: 'post',
    params: {
      id
    }
  })
}

export const routesSF = (id) => {
  return request({
    url: '/api/celery-delivery/delivery/routes-sf',
    method: 'get',
    params: {
      id,
    }
  })
}

export const cancelConfirm = (ids) => {
  return request({
    url: '/api/celery-delivery/delivery/cancel-confirm',
    method: 'post',
    params: {
      ids,
    }
  })
}
